7960a4592e037c8ad22bd4e3cdb58e7505194915,advanced/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/XaLogicalLog.java,XaLogicalLog,extractLogEntryList,#number#,1095
Before Change
// TODO: could we refactor this to take a LogBuffer as argument to avoid
// creating the in-memory representation?
List<LogEntry> logEntryList = null;
Triplet<Long, Integer, Long> cachedInfo = this.txStartPositionCache.get( txId );
if ( cachedInfo != null )
{
// We have log version and start position cached
long version = cachedInfo.first();
ReadableByteChannel log = getLogicalLogOrMyself( version, cachedInfo.third() );
logEntryList = extractTransactionFromLog( txId, version, log );
log.close();
}
else
{
// We have to look backwards in log files
long version = findLogContainingTxId( txId )[0];
if ( version == -1 )
{
throw new RuntimeException( "txId:" + txId + " not found in any logical log "
+ "(starting at " + logVersion
+ " and searching backwards" );
}
ReadableByteChannel log = getLogicalLogOrMyself( version, 0 );
long[] header = readAndAssertLogHeader( buffer, log, version );
long prevTxId = header[1];
assertLogCanContainTx( txId, prevTxId );
logEntryList = extractTransactionFromLog( txId, version, log );
log.close();
}
return logEntryList;
}
public synchronized ReadableByteChannel getCommittedTransaction( long txId )
After Change
log.close();
}
private LogEntry.Commit extractLogEntryList( long txId, LogBuffer targetBuffer ) throws IOException
{
// TODO: could we refactor this to take a LogBuffer as argument to avoid
// creating the in-memory representation?
long version = 0;
ReadableByteChannel log = null;
TxPosition txPosition = txStartPositionCache.get( txId );
try
{
if ( txPosition != null )
{
// We have log version and start position cached
version = txPosition.version;
log = getLogicalLogOrMyself( version, txPosition.position );
}
else
{
// We have to look backwards in log files
version = findLogContainingTxId( txId )[0];
if ( version == -1 )
{
throw new RuntimeException( "txId:" + txId + " not found in any logical log "
+ "(starting at " + logVersion
+ " and searching backwards" );
}
log = getLogicalLogOrMyself( version, 0 );
long[] header = readAndAssertLogHeader( buffer, log, version );
long prevTxId = header[1];
assertLogCanContainTx( txId, prevTxId );
}
return extractTransactionFromLog( txId, version, log, targetBuffer );
}
finally
{